package com.shop.controller;

import com.shop.domain.Export;
import com.shop.service.ExportService;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

import javax.annotation.Resource;
import java.util.List;

/**
 * ExportController
 * 出口货运和购销合同查询
 * Created by heqianqian on 2017/7/28.
 */
@Controller
@RequestMapping("/cargo/export")
public class ExportController {

    @Resource
    private ExportService<Export> exportExportService;

    /**
     * 购销合同查询
     */
    @RequestMapping("/contract_list")
    public String contractList(Model model) {
        List<Export> exports = exportExportService.listExport();
        model.addAttribute("dataList", exports);
        return "/cargo/export/exp_list";
    }

    /**
     * 跳转到购销合同修改页面
     */
    @RequestMapping("/modify")
    public String modifyView(@RequestParam("exportId") Long exportId, Model model) {
        Export export = exportExportService.get(exportId);
        model.addAttribute("obj",export);
        return "/cargo/export/exp_update";
    }

}
